package com.fzh.bookstore.biz.banner.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzh.bookstore.biz.banner.dto.BannerInfoReqest;
import com.fzh.bookstore.biz.banner.dto.BannerListRequest;
import com.fzh.bookstore.biz.banner.dto.BannerPositionRequest;
import com.fzh.bookstore.biz.banner.dto.BannerRequest;
import com.fzh.bookstore.biz.banner.entity.Banner;
import com.fzh.bookstore.biz.banner.mapper.BannerMapper;
import com.fzh.bookstore.biz.banner.service.BannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzh.bookstore.dto.SuperResponse;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fang
 * @since 2021-02-25
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {


    @Override
    public SuperResponse list(BannerListRequest request) {
        return null;
    }

    @Override
    public SuperResponse addBanner(BannerInfoReqest reqest) {
        return null;
    }

    @Override
    public SuperResponse updateBanner(BannerInfoReqest reqest) {
        return null;
    }

    @Override
    public SuperResponse delBanner(BannerRequest request) {
        return null;
    }



    @Override
    public SuperResponse getBannerByPosition(BannerPositionRequest request) {
        SuperResponse response = new SuperResponse();
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("status","T");
        queryWrapper.eq("position",request.getPosition());
        queryWrapper.orderByDesc("modify_time");
        queryWrapper.last("limit 0,5");
        response.setItems(baseMapper.selectList(queryWrapper));
        return response;
    }


}
